package com.ruoyi.match.mapper;

import java.util.List;
import com.ruoyi.match.domain.MemberTeam;
import org.apache.ibatis.annotations.Param;

/**
 * 队员队伍Mapper接口
 * 
 * @author zhangrui
 * @date 2025-03-26
 */
public interface MemberTeamMapper 
{
    /**
     * 查询队员队伍
     * 
     * @param userId 队员队伍主键
     * @return 队员队伍
     */
    public MemberTeam selectMemberTeamByUserId(Long userId);

    /**
     * 查询队员队伍列表
     * 
     * @param memberTeam 队员队伍
     * @return 队员队伍集合
     */
    public List<MemberTeam> selectMemberTeamList(MemberTeam memberTeam);

    /**
     * 新增队员队伍
     * 
     * @param memberTeam 队员队伍
     * @return 结果
     */
    public int insertMemberTeam(MemberTeam memberTeam);

    /**
     * 修改队员队伍
     * 
     * @param memberTeam 队员队伍
     * @return 结果
     */
    public int updateMemberTeam(MemberTeam memberTeam);

    /**
     * 删除队员队伍
     * 
     * @param userId 队员队伍主键
     * @return 结果
     */
    public int deleteMemberTeamByUserId(Long userId);

    /**
     * 批量删除队员队伍
     * 
     * @param userIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteMemberTeamByUserIds(Long[] userIds);



    /**
     * 检查当前用户是否已经存在于队伍中
     *
     * @param
     * @return 结果
     */
    public int checkIfMemberExists(Long userId, Long teamId);


    /**
     * 根据userid查询已经加入的队伍id
     *
     * @param userId 队员队伍主键
     * @return 队员队伍
     */
    public List<Long> selectJoinedTeamByUserId(Long userId);



    //    用户自己退出队伍
    public int leaveTeam(@Param("userId")Long userId, @Param("teamId")Long teamId);



    /**
     * 通过队伍id删除队员队伍
     *
     * @param teamId 队员队伍主键
     * @return 结果
     */
    public int deleteMemberTeamByTeamId(Long teamId);


//    根据队伍id查询队员数量

    public int selectMemberCountByTeamId(Long teamId);

    int removeMember(MemberTeam memberTeam);
}
